/**
 * https://leetcode-cn.com/problems/merge-sorted-array/
 * @param {number[]} nums1
 * @param {number} m
 * @param {number[]} nums2
 * @param {number} n
 * @return {void} Do not return anything, modify nums1 in-place instead.
 */
var merge = function(nums1, m, nums2, n) {
    let p1 = nums1.length - 1;
    let p2 = 0;
    while (p1 >= n) {
        nums1[p1] = nums1[p1 - n];
        p1--;
    }
    p1 = n;
    let i = 0;
    while (p1 < m + n && p2 < n) {
        if (nums1[p1] < nums2[p2]) {
            nums1[i] = nums1[p1];
            p1++;
        } else {
            nums1[i] = nums2[p2];
            p2++;
        }
        i++;
    }
    while (p1 < m + n) {
        nums1[i] = nums1[p1];
        p1++;
        i++;
    }
    while (p2 < n) {
        nums1[i] = nums2[p2];
        p2++
        i++;
    }
};